<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>03父组件和子组件</title>
</head>
<body>
    <div id="app">
        <mycpn2></mycpn2>
    </div>
</body>
<script src="../js/vue.js"></script>
<script>
    // 创建第一个组件(子组件)
    let cpn1 = Vue.extend({
        template:`
            <div>
                <p>哈哈哈哈</p>
                <p>呵呵呵呵呵</p>
            </div>
        `
    })
    // 创建第二个组件(父组件)
    let cpn2 = Vue.extend({
        template:`
            <div>
                <p>哈哈哈哈2</p>
                <p>呵呵呵呵呵2</p>
                <mycpn1></mycpn1>
            </div>
        `,
        components:{
            mycpn1:cpn1
        }
    })
    let app = new Vue({
        el:'#app',
        data:{},
        methods:{},
        components:{
            mycpn2:cpn2
        }
    })
</script>
</html>